package com.example.coursehub.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.Hibernate;

import java.io.Serializable;
import java.util.Objects;

@Getter
@Setter
@Embeddable
public class CourseQuestionBankQuestionId implements Serializable {
    private static final long serialVersionUID = -1193897638640778924L;
    @Column(name = "course_question_bank_id", nullable = false, length = 100)
    private String courseQuestionBankId;

    @Column(name = "question_id", nullable = false, length = 100)
    private String questionId;
    public CourseQuestionBankQuestionId(){

    }
    public CourseQuestionBankQuestionId(String courseQuestionBankId, String questionId) {
        this.questionId=questionId;
        this.courseQuestionBankId=courseQuestionBankId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
        CourseQuestionBankQuestionId entity = (CourseQuestionBankQuestionId) o;
        return Objects.equals(this.questionId, entity.questionId) &&
                Objects.equals(this.courseQuestionBankId, entity.courseQuestionBankId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(questionId, courseQuestionBankId);
    }

}